function inspectionReport(id){
	$.ajax({
		url : "zyInspectionPlanController.do?doJudgePlanOfEngineerAddReport",
		data : {
			"id" : id
		},
		cache : false,
		dataType : 'json',
		type : 'POST',
		success : function(data){
			if(data.success){
				addOneTab("填写巡检报告","zyInspectionReportController.do?goAdd&planId="+id,"");
			}else{
				tip(data.msg);
			}
		}
	});
}
function refuseInToolBar(){
	var planIds = getSelections();
	if(!planIds){
		return;
	}
	$.ajax({
		url : "zyInspectionPlanController.do?doJudgePlanOfEngineerRefusePlan",
		data : {
			"planIds" : planIds,
			"type" : "refuse"
		},
		cache : false,
		dataType : 'json',
		type : 'POST',
		success : function(data){
			if(data.success){
				createwindow("填写拒绝原因","zyInspectionPlanController.do?goBatchEngineerRefusePlan&planIds="+planIds,500,300);
			}else{
				tip(data.msg);
			}
		}
	});
}
function assignInToolBar(){
	var planIds = getSelections();
	if(!planIds){
		return;
	}
	$.ajax({
		url : "zyInspectionPlanController.do?doJudgePlanOfEngineerRefusePlan",//第一次判断 是否可以接受任务，防止停顿在当前确认提示框期间在app操作
		data : {
			"planIds" : planIds,
			"type" : "assign"
		},
		cache : false,
		dataType : 'json',
		type : 'POST',
		success : function(data){
			if(data.success){
				createwindow("工程师接受任务","zyInspectionPlanController.do?goEgAssignMission&planIds="+planIds,500,150);
			}else{
				tip(data.msg);
			}
		}
	});
	
}
function getSelections(){
	var datas = $("#zyInspectionPlanList").datagrid("getSelections");
	if(datas.length == 0){
		tip("请选择巡检任务!");
		return;
	}
	var planIdArr = new Array();
	$.each(datas,function(i,item){
		planIdArr.push(item.id);
	});
	return planIdArr.join(",");
}
function planDetials(filedName,url){
	addOneTab("任务详情",url);
}
